package marina;

import java.util.Scanner;

public class J13Ex46CalendarV1 {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double cyear = sc.nextDouble();
		double what = ((cyear - 1) * 365 + (cyear - 1) / 4 - (cyear - 1) / 100 + (cyear - 1) / 400) % 7;
		char day = ' ';
		switch((int)what+1){
		case 0: 
			day = '일';
			break;
		case 1: 
			day = '월';
			break;
		case 2: 
			day = '화';
			break;
		case 3: 
			day = '수';
			break;
		case 4: 
			day = '목';
			break;
		case 5: 
			day = '금';
			break;
		case 6: 
			day = '토';
			break;
		}
		sc.close();
		System.out.println(cyear + "년 1월 1일의 요일은 " + day);
	}
}
